package ar.uba.fi.tonyvaliente;

import java.util.BitSet;

import ar.uba.fi.tonyvaliente.persistors.BitSetPersistor;
import ar.uba.fi.tonyvaliente.utils.BitSetUtils;
import ar.uba.fi.tonyvaliente.utils.io.ByteCompletionMode;

public class BitSetTests {

	public static void main(String[] args) {
		try {
			BitSet bs1 = new BitSet(64);
			BitSet bs2 = new BitSet(128);
			for (int i = 0; i < bs1.size(); i++) {
				bs1.set(i, (i % 13 == 0));
			}
			
			for (int i = 0; i < bs2.size(); i++) {
				bs2.set(i, (i % 13 == 0));
			}
			
			System.out.println("bs1: " + bs1 + ',' + bs1.size());
			System.out.println("bs2: " + bs2 + ',' + bs2.size());
			
			BitSet concat = BitSetUtils.concat(bs1, bs2);
			System.out.println("con: " + concat + ',' + concat.size());
			
			BitSetPersistor persistor = new BitSetPersistor(ByteCompletionMode.NONE);
			byte[] bytes = persistor.serialize(concat);
			
			concat = persistor.deserialize(bytes);
			
			System.out.println("con: " + concat + ',' + concat.size());
			
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
